package com.qianying.entity;

import com.baomidou.mybatisplus.annotation.*;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Getter;
import lombok.Setter;

import java.io.Serializable;
import java.time.LocalDateTime;

/**
 * <p>
 * 用户信息表
 * </p>
 *
 * @author check
 * @since 2025-07-15
 */
@Getter
@Setter
@TableName("sys_user")
@Schema(description = "用户信息表，存储系统用户的基本信息")
public class SysUser implements Serializable {

    private static final long serialVersionUID = 1L;

    @TableId(value = "id", type = IdType.AUTO)
    @Schema(description = "主键ID，自增", example = "1")
    private Long id;

    /**
     * 用户名
     */
    @TableField("username")
    @Schema(description = "用户名，系统登录账号", example = "admin", required = true)
    private String username;

    /**
     * 密码
     */
    @TableField("password")
    @Schema(description = "密码，加密存储", example = "$2a$10$xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx", required = true)
    private String password;

    /**
     * 0无效用户，1是有效用户
     */
    @TableField("enabled")
    @Schema(description = "用户状态（0-无效用户，1-有效用户）", example = "1")
    private Boolean enabled;

    /**
     * 手机号
     */
    @TableField("phone")
    @Schema(description = "用户手机号码", example = "13800138000")
    private String phone;

    /**
     * 用户创建时间
     */
    @TableField(value = "create_time", fill = FieldFill.INSERT)
    @Schema(description = "用户创建时间，自动填充", example = "2025-07-15T10:30:00")
    private LocalDateTime createTime;

    /**
     * 角色id
     */
    @TableField("role_id")
    @Schema(description = "角色ID，关联sys_role表的主键", example = "1")
    private Long roleId;


    @TableField("another_name")
    @Schema(description = "用户别名", example = "张三")
    private String anotherName;


    @TableField("des")
    @Schema(description = "用户介绍", example = "我是张三，XX客户")
    private String des;

    @TableField(exist = false)
    private String roleName;
}
